# Contributor: Díaz Urbaneja Diego <sodomon2@gmail.com>
# Maintainer: Díaz Urbaneja Diego <sodomon2@gmail.com>
pkgname=pegasus-frontend
pkgver=13_alpha
_realver=alpha13
pkgrel=0
pkgdesc="A cross platform, customizable graphical frontend for launching emulators and managing your game collection."
url="http://pegasus-frontend.org"
arch="all !armhf !mips !mips64"
license="GPL-1.0-or-later"
depends="qt5-qtquickcontrols mesa qt5-qtgraphicaleffects qt5-qtgamepad qt5-qtmultimedia"
makedepends="qt5-qttools-dev openssl qt5-qtsvg-dev qt5-qtquickcontrols2-dev qt5-qtbase-dev qt5-qtdeclarative-dev qt5-qtgamepad-dev qt5-qtmultimedia-dev"
subpackages="$pkgname-doc"
options="!check" #disabled due to compilation problems
_translations_commit=b9eb734f8583e044b999d8c673dd5da0851ec8f5
_thirdparty_commit=a16b36d64ced67da31a3465ba6a7ad593378a0eb
_theme_commit=ccaf3152574992eacbda81ccf6624731e07e963e
source="$pkgname-$_realver.zip::https://github.com/mmatyas/pegasus-frontend/archive/$_realver.zip
	$pkgname-$_realver-translations.zip::https://github.com/mmatyas/$pkgname-translations/archive/$_translations_commit.zip
	$pkgname-$_realver-thirdparty.zip::https://github.com/mmatyas/SortFilterProxyModel/archive/$_thirdparty_commit.zip
	$pkgname-$_realver-themes.zip::https://github.com/mmatyas/pegasus-theme-grid/archive/$_theme_commit.zip
	qt-5-14-compatibility.patch
	"
builddir="$srcdir/$pkgname-$_realver"

prepare() {
	default_prepare
	mv "$srcdir"/$pkgname-translations-$_translations_commit/* "$builddir"/lang
	mv "$srcdir"/SortFilterProxyModel-$_thirdparty_commit/* "$builddir"/thirdparty/SortFilterProxyModel
	mv "$srcdir"/pegasus-theme-grid-$_theme_commit/* "$builddir"/src/themes/pegasus-theme-grid
}

build() {
	qmake-qt5 pegasus.pro \
	    INSTALL_BINDIR=/usr/bin \
	    INSTALL_DATADIR=/usr/share/pegasus-frontend \
	    INSTALL_ICONDIR=/usr/share/pixmaps \
	    INSTALL_DESKTOPDIR=/usr/share/applications
	make
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	install -Dm644 "README.md" "$pkgdir"/usr/share/doc/"$pkgname"/README.md
	install -Dm644 "LICENSE.md" "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}

sha512sums="b80b05c7120c2c740f49b73b248003d2f46a524ce64cdde5feb6ee791bd25c291c1b036b95ca507557b7a65bd94d5587b74b575c5bfacb6d65ac1d7803654342  pegasus-frontend-alpha13.zip
48265568df3f83efa372d45233b0954f0e3a48e4085e0beeed01f2601e580cb1af9713d7edb48c010afa9af9e952df256718e99402fa2363c548a939682cdd8e  pegasus-frontend-alpha13-translations.zip
545ace1a9641e988f3fbc91a5933ef05f5044fef672d50347dc890ca13efdf325d0c28eb0612040c2cf743fe8fbf80e1b16b236382fdb5bd7d495e95d0c02860  pegasus-frontend-alpha13-thirdparty.zip
ac6addb71483e5f45f60a5815b4f1e6695f794446bacc3323a84155c03ec95e08d084ee4879c381cef428114f34596837e088de03b55679eeed2bd5bb1126bb8  pegasus-frontend-alpha13-themes.zip
a6d6ade0a963291f790f7607d53a7c33aad48bff6c3f8a49c48170af30353b2563103201c7bf1017dbc0daf9fe4ed34f00196c5f16c742d89fe2b407fe96359f  qt-5-14-compatibility.patch"
